package fun.hijklmn.magic.idGenerator.common.enums;

import java.io.Serializable;

/**
 * @Description
 * @Author fs
 * @Date 2021/7/12 16:41
 * @Version 0.0.1-SNAPSHOT
 **/
public enum ServerTypeEnum implements Serializable {

    admin_server(1, "ADM", "admin_server"),
    image_server(2, "IMG", "image_server"),
    ;

    private Integer type;

    private String shortCode;

    private String serverName;

    public Integer type() {
        return this.type;
    }

    public String shortCode() {
        return this.shortCode;
    }

    public String serverName() {
        return this.serverName;
    }

    ServerTypeEnum (Integer type, String shortCode, String serverName) {
        this.type = type;
        this.shortCode = shortCode;
        this.serverName = serverName;
    }

    public ServerTypeEnum getByType(Integer type) {
        for (ServerTypeEnum serverTypeEnum : ServerTypeEnum.values()) {
            if (serverTypeEnum.type.intValue() == type) {
                return serverTypeEnum;
            }
        }
        return null;
    }

}
